﻿using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Data;
namespace SistemaInformativoTuristico
{
    public class ClaseAutentificacion
    {
        private SqlConnection conectar1;
        private SqlCommand comando;
        private SqlDataAdapter adaptador;
        private DataTable tabla;

        private void iniciar() {

            try
            {               
                conectar1 = new SqlConnection();
               conectar1.ConnectionString = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Sistematurismo;Data Source=NEMACYST\\SQLEXPRESS";
                conectar1.Open();
            }
            catch { }
        
        }
    
        public bool SelectAdministrador(string cedula, string contra)
        {
            iniciar();
            try
            {
                MD5 md5 = new MD5();


                string password = md5.md5(contra);

                comando = new SqlCommand("SelectAdministrador", conectar1);
                comando.CommandType = CommandType.StoredProcedure;
                SqlParameter prm1 = new SqlParameter("@cedula", cedula);
                SqlParameter prm2 = new SqlParameter("@contra", password);

              

                comando.Parameters.Add(prm1);
                comando.Parameters.Add(prm2);
               

                int a = comando.ExecuteNonQuery();
                
                if (a> 0)


                { return false;
                }
             }
            catch
            {
                
            }
            return true;
             
        }

    }
}